package servlets;

import java.util.ArrayList;
import java.util.Date;

public class PatientManager {

	private static PatientManager _instance;
	private static final PatientDAO patientDao = new PatientDAO();
	private static final ConsultationRecordDAO consultationRecordDao = new ConsultationRecordDAO();
	private static final LabTestRecordDAO labTestRecordDao = new LabTestRecordDAO();
	private static final LabTestListDAO labTestListDao = new LabTestListDAO();

	public static PatientManager getInstance() {
		if (_instance == null) {
			_instance = new PatientManager();
		}

		return _instance;
	}

	public Patient createPatient(String name, String gender, String occupation,
			String address, int status, String physician, Date dateOfBirth,
			Date dateOfRegistration, String medicalHistory) {
		return patientDao.createPatient(name, gender, occupation, address,
				status, physician, dateOfBirth, dateOfRegistration,
				medicalHistory);
	}

	public Patient getPatient(int patientId) {
		return patientDao.getPatient(patientId);
	}

	public ConsultationRecord createConsultationRecord(String complaints,
			String diagnosis, String prescription, int patientId, int staffId,
			float price, Date date) {
		return consultationRecordDao.createConsultationRecord(complaints,
				diagnosis, prescription, patientId, staffId, price, date);
	}

	public ArrayList<ConsultationRecord> geConsultationRecordByPatientId(
			Integer patientId) {
		return consultationRecordDao.geConsultationRecordByPatientId(patientId);
	}

	public LabTestRecord createLabTestRecord(Date date, int status,
			int staffId, int patientId, float totalPrice) {
		return labTestRecordDao.createLabTestRecord(date, status, staffId,
				patientId, totalPrice);
	}

	public LabTestList createLabTestList(int labTestRecordId, int labTestId) {
		return labTestListDao.createLabTestList(labTestRecordId, labTestId);
	}

	public ConsultationRecord getConsultationRecord(int consultationRecordId) {
		return consultationRecordDao
				.getConsultationRecord(consultationRecordId);
	}

	public ArrayList<LabTestRecord> getLabTestRecords(Integer patientId) {
		return labTestRecordDao.getAllLabTestRecordByPatient(patientId);
	}

}
